<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"> -->
    <title>主办方未通过审核的赛事</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/xadmin.css">
    <script type="text/javascript" src="../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/xadmin.js"></script>
    <script src="../js/base.js"></script>
    <script src="../js/jquery.min.js"></script>
    <script src="../js/vue.min.js"></script>
</head>

<body>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card" style="display: flex;justify-content: space-between;">
                    <div class="layui-card-body ">
                        <blockquote class="layui-elem-quote" style="border:0;font-size: 18px;color: #000;">赛事列表
                        </blockquote>
                    </div>
                </div>
            </div>
            <div class="layui-card-body layui-table-body layui-table-main">
                <!-- 表格部分开始 -->
                <table id="application_table" lay-filter="test" lay-data="{id: 'testReload'}"></table>
                <script type="text/html" id="barDemo">
                    <a lay-event="watch" class="btn_a layui-btn layui-btn-xs">查看</a>
                </script>
            </div>
        </div>
    </div>
</body>

</html>

<script>

    layui.use('table', function () {
        var table = layui.table;
        var index = layer.load(1); //添加laoding,0-2两种方式

        //第一个实例
        table.render({
            elem: '#application_table',
            width: "100%",
            loading: true,
            method: 'post',
            url: findNewcompetitionByOrganizersId, 
            page: true, 
            limit: 10,
            limits: [10, 20, 30, 50, 100, 500, 1000, 5000, 10000],
            cols: [[ //表头
                { field: 'name', title: '赛事名城', width: 300 ,align:'center'}, 
                { field: 'organizers', title: '主办方', width: 300,align:'center' }, 
                { field: 'province', title: '省份', width: 150 ,align:'center'}, 
                { field: 'city', title: '市区', width: 150 ,align:'center' }, 
                { field: 'competitionStartTime', title: '赛事开始时间', width: 200 ,align:'center' },
                {
                    fixed: 'right',
                    title: "操作",
                    width: 150,
                    align: 'center',
                    toolbar: '#barDemo'
                }
            ]],
            id: 'testReload',
            done: function (res) {
                if (res.msg == "2") {
                    parent.window.location.href = getRequestPrefix() +
                        "/footBallAdmin/login.html"
                }
                layer.close(index)
            }
        });

        table.on('tool(test)', function (obj) { //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
            //获得当前行数据
            var $ = layui.$
            var data = obj.data,
                layEvent = obj.event; //获得 lay-event 对应的值
            if(layEvent == 'watch'){
                layer.open({
                    content: "match_info.html",
                    type: 2,
                    area: ["100%", "100%"],
                    title: "查看信息",
                    shadeClose: true,
                    success: function (layero, index) {
                        //获取点击行的数据,获取打开的iframe
                        // console.log(data)
                        var body = layer.getChildFrame('body', index);
                        var iframeWin = window[layero.find('iframe')[0]['name']];
                        body.find('.title').attr("data-val", data.id)
                    }
                })
            }
        })

    });
</script>